package map;

import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;

import math.Vector2D;

import images.ImageLoader;

public class Tile
{
	private ImageLoader img;
	private boolean isOccupied;

	private Tile expandedFrom;
	
	private Vector2D location;
	
	private double g, h;
	
	public Tile( ImageLoader image, Vector2D location )
	{
		img = image;
		isOccupied = false;
		
		this.location = location;
		
		h = g = 0;
	}
	
	public void render( Graphics2D g )
	{
		img.draw( g, AffineTransform.getTranslateInstance( location.getX() - img.width() / 2, location.getY() - img.height() / 2 ) );
	}
	
	public ImageLoader getImage()
	{
		return img;
	}
	
	public void setImage( ImageLoader image )
	{
		img = image;
	}
	
	public Vector2D getLocation()
	{
		return location;
	}
	
	public boolean isOccupied()
	{
		return isOccupied;
	}
	
	public void setOccupied( boolean b )
	{
		isOccupied = b;
	}
	
	public void setExpandedFrom( Tile p )
	{
		expandedFrom = p;
	}
	
	public Tile getExpandedFrom()
	{
		return expandedFrom;
	}
		
	public void setH( double h )
	{
		this.h = h;
	}
	public void setG( double g )
	{
		this.g = g;
	}
	
	public double getH()
	{
		return h;
	}
	
	public double getG()
	{
		return g;
	}
	
	public double getF()
	{
		return g + h;
	}
}
